﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Abp.Application.Navigation;
using Abp.Runtime.Session;
using KelonProud.Administration.Services;
using Microsoft.AspNetCore.Mvc;

namespace KelonProud.Web.Views.Home.Components.SideBarNavMenu
{
    public class SideBarNavMenuViewComponent : KelonProudViewComponent
    {
        private readonly INavigationProvider _navigationProvider;
        private readonly IUserNavigationManager _userNavigationManager;
        private readonly IAbpSession _abpSession;

        public SideBarNavMenuViewComponent(
            IUserNavigationManager userNavigationManager,
            IAbpSession abpSession, INavigationProvider navigationProvider)
        {
            _userNavigationManager = userNavigationManager;
            _abpSession = abpSession;
            _navigationProvider = navigationProvider;
        }

        public async Task<IViewComponentResult> InvokeAsync(string searchStr = "")
        {
            var model = new SideBarNavMenuViewModel
            {
                Items = await _navigationProvider.GetUserTopNavigations(searchStr)
            };

            return View(model);
        }
    }
}
